package cn.smartorigin.soas.frame.menubar;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JMenuItem;
import javax.swing.border.Border;

import cn.smartorigin.soas.frame.SoasUtil;

public class CellMenuItem extends JMenuItem{
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Color backgroundColor = SoasUtil.MENUITEM_BACKGROUND;
    private Color foregroundColor = SoasUtil.DEFAULT_TEXT_COLOR;
    private int borderThickness = 1;
    private Border border = BorderFactory.createLineBorder(backgroundColor, borderThickness);
    private int preferredHeight = 23;
    
    
    public CellMenuItem(Action a) {
		super(a);
		init();
	}

	public CellMenuItem(Icon icon) {
		super(icon);
		init();
	}
	
	public CellMenuItem() {
		super();
		init();
	}

	public CellMenuItem(String text) {
		super(text);
		init();
	}

	public CellMenuItem(String text, Icon icon) {
		super(text, icon);
		init();
	}

	public CellMenuItem(String text, int mnemonic) {
		super(text, mnemonic);
		init();
	}
     
    private void init() {

        this.setForeground(foregroundColor);
        this.setFont(SoasUtil.FONT_12_BOLD);
        this.setBackground(backgroundColor);
        this.setBorder(border);
    }
    
    
    @Override
    public Dimension getPreferredSize() {
        return new Dimension(super.getPreferredSize().width, preferredHeight);
    }
}
